package cn.marinda.gui.impl;

import cn.marinda.MinecraftServerHelper;
import cn.marinda.gui.AbstractHelper;
import cn.marinda.listener.ChangeServerConsoleActivityEvent;
import cn.marinda.listener.OpenCreateServerEvent;
import cn.marinda.listener.OpenOnlineCoreEvent;
import cn.marinda.listener.OpenOnlinePluginEvent;
import lombok.Data;

import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.List;

/**
 *
 * 主要入口Gui
 * @author Marinda
 * @date 2022/07/06
 */
@Data
public class ApplicationHelperImpl extends AbstractHelper {

    public static ApplicationHelperImpl instance = new ApplicationHelperImpl();
    private ApplicationHelperImpl(){
        super();
    }

    @Override
    protected JFrame loadFrame() {
        frame = new JFrame();
        frame.setSize(700,600);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setTitle("美年达服务器助手");
        frame.setJMenuBar(menuBar);
        frame.setContentPane(view);
        return frame;
    }

    @Override
    protected JPanel loadPanel() {
        view = new JPanel();
        view.setLayout(new BorderLayout(20,20));
        for(Component component : componentList){
            view.add(component);
        }
        return view;
    }


    /**
     * 加载组件
     *
     * @return {@link List}<{@link Component}>
     */
    @Override
    protected List<Component> loadComponent() {
        JLabel text = createTextComponent("欢迎使用美年达服务器助手",SwingConstants.CENTER);
        text.setFont(new Font(null,Font.BOLD,30));
        componentList.add(text);
        return componentList;
    }




}
